Tryit Editor v2.3

Edit This Code:
<!DOCTYPE HTML> <html> <head> <style> #div1, #div2 {float:left; width:100px; height:35px; margin:10px;padding:10px;border:1px solid #aaaaaa;} </style> <script> function allowDrop(ev) { ev.preventDefault(); } function drag(ev) { ev.dataTransfer.setData("text", ev.target.id); } function drop(ev) { ev.preventDefault(); var data = ev.dataTransfer.getData("text"); ev.target.appendChild(document.getElementById(data)); } </script> </head> <body> <div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)"> <img src="img_w3slogo.gif" draggable="true" ondragstart="drag(event)" id="drag1" width="88" height="31"> </div> <div id="div2" ondrop="drop(event)" ondragover="allowDrop(event)"></div> </body> <!-- Mirrored from www.w3schools.com/html/tryit.asp?filename=tryhtml5_draganddrop2 by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 07:20:58 GMT --> </html>
Result:
Try it Yourself - © w3schools.com